package com.aegean.onlinebook.service.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import javax.annotation.Resource;

import org.hibernate.Hibernate;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.onlinebook.model.ServiceValue;
import com.aegean.onlinebook.model.component.Photo;
import com.aegean.onlinebook.service.business.ServiceBusiness;
import com.opensymphony.xwork2.ActionSupport;

@Controller
@Scope("prototype")
public class loginAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6234544928684736403L;
	/**
	 * 
	 */
	@Resource ServiceBusiness business;
	private boolean success;
	private String msg;
	private String dir;
	public String getDir() {
		return dir;
	}
	public void setDir(String dir) {
		this.dir = dir;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	private ServiceValue service;
	public ServiceValue getService() {
		return service;
	}
	public void setService(ServiceValue service) {
		this.service = service;
	}
	@Override
	public String execute() throws Exception {
		success=business.searchService(service);
		if(success==true){
			msg="登陆成功，即将登陆主页";
			dir="main.html";
		}else{
			msg="对不起，您的用户名或者密码错误";
		}
		return SUCCESS;
	}
	
}
